﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace OCSMgmt
{
    class User
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="UserDN"></param>
        /// <param name="PrimaryURI"></param>
        /// <param name="Enabled"></param>
        /// <param name="DisplayName"></param>
        /// <param name="InstanceID"></param>
        public User(String UserDN, String PrimaryURI, bool Enabled, String DisplayName, String InstanceID) 
        {
            _UserDN = UserDN;
            _PrimaryURI = PrimaryURI;
            _enabled = Enabled;
            _DisplayName = DisplayName;
            _InstanceID = InstanceID;
        }
        String _DisplayName;     //Display Name
        [DisplayName("Display Name")]
        public String DisplayName
        {
            get { return _DisplayName; }
            set { _DisplayName = value; }
        }

        String _PrimaryURI;      //User SIP URI
        [DisplayName("Primary URI")]
        public String PrimaryURI
        {
            get { return _PrimaryURI; }
            set { _PrimaryURI = value; }
        }

        String _UserDN;          //User Distinguished Name (LDAP)
        [Browsable(false)]
        public String UserDN
        {   [Browsable(false)]
            get { return _UserDN; }
            set { _UserDN = value; }
            
        }
        
        bool _enabled;           //OCS Enabled
        [Browsable(false)]
        public bool Enabled
        {
            get { return _enabled; }
            set { _enabled = value; }
        }
        
        String _InstanceID;      //InstanceID
        [Browsable(false)]
        public String InstanceID
        {
            get { return _InstanceID; }
            set { _InstanceID = value; }
        }


        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType()) return false;
            User u = (User)obj;
            return u.PrimaryURI.ToLower() == this.PrimaryURI.ToLower();
            //return base.Equals(obj);
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }
}
